import {systemStoreHook} from "@/stores/modules";
import {commonState} from "@/common/index.js";

const systemStore = systemStoreHook();

export const pageSearch = reactive({
    pageNumber: commonState.pageNumber,
    pageSize: commonState.pageSize
});
export const tableState = reactive({
    totalCount: 0,
    records: []
});

export const state = reactive({
    selectedRowKeys: [],
    loading: false,
    subLoading: false,
});
export const setLoading = (loading) => {
    state.loading = loading;
}

export const setSubLoading = (loading) => {
    state.subLoading = loading;
}

//表单列表
export const columns = [
    {
        title: '字典编码',
        dataIndex: 'code',
        key: 'code',
        align: 'left',
        ellipsis: true
    },
    {
        title: '字典名称',
        dataIndex: 'name',
        key: 'name',
        align: 'left',
        ellipsis: true
    },
    {
        title: '操作',
        key: 'operation',
        fixed: 'right',
        align: 'center'
    }
]
export const rules = reactive({
    code: [{required: true, message: '请输入代码类型', trigger: 'blur'}],
    name: [{required: true, message: '请输入代码类型名称', trigger: 'blur'}]
});
//明细
export const detailState = reactive({})

//设置查询参数
export function setSearchParam() {
    Object.assign(pageSearch, systemStore.getDictSearch);
    return pageSearch;
}
